<template>
  <a-drawer
    width="60%"
    title="客户进件"
    :label-col="4"
    :wrapper-col="14"
    :visible="open"
    :body-style="{ height: 'calc(100vh - 100px)', overflow: 'auto' }"
    @close="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row
          :gutter="32"
          style="width: 80%; margin-left: 15%; margin-top: -10px"
        >
          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >基本信息</span
              >
            </div>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="客户姓名" prop="customerName">
              <a-input
                v-model="form.customerName"
                placeholder="请选择客户"
                disabled
                @search="handleOnSearchCustomer"
              >
              </a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="电话" prop="phone">
              <a-input v-model="form.phone" placeholder="请输入电话" disabled />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="客服" prop="servcieUserName">
              <a-input
                v-model="form.servcieUserName"
                placeholder="请选择客服"
                style="width: 100%"
                disabled
              >
              </a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >进件信息</span
              >
            </div>
          </a-col>
        </a-row>
        <a-row
          :gutter="32"
          style="width: 80%; margin-left: 15%; margin-top: -10px"
          v-if="form.orgType && form.isTgOne === '1'"
        >
          <a-col :span="8">
            <a-form-model-item label="服务机构（一）" prop="orgType">
              <a-select
                placeholder="请选择服务机构"
                v-model="form.orgType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @change="handleGetProductInfo"
                disabled
              >
                <a-select-option
                  v-for="(d, index) in orgTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="产品名称（一）" prop="productId">
              <a-select
                placeholder="请选择产品"
                v-model="form.productId"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @select="handleChooseProduct"
                disabled
              >
                <a-select-option
                  v-for="d in productList"
                  :key="d.productName"
                  :value="d.id"
                  >{{ d.productName }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row
          :gutter="32"
          style="width: 80%; margin-left: 15%; margin-top: -10px"
          v-if="form.orgTypeTwo && form.isTgTwo === '1'"
        >
          <a-col :span="8" v-if="proTwo">
            <a-form-model-item label="服务机构（二）" prop="orgTypeTwo">
              <a-select
                placeholder="请选择服务机构"
                v-model="form.orgTypeTwo"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @change="handleGetProductInfoTwo"
                disabled
              >
                <a-select-option
                  v-for="(d, index) in orgTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="proTwo">
            <a-form-model-item label="产品名称（二）" prop="productIdTwo">
              <a-select
                placeholder="请选择产品"
                v-model="form.productIdTwo"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @select="handleChooseProductTwo"
                disabled
              >
                <a-select-option
                  v-for="d in productListTwo"
                  :key="d.productName"
                  :value="d.id"
                  >{{ d.productName }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row
          :gutter="32"
          style="width: 80%; margin-left: 15%; margin-top: -10px"
          v-if="form.orgTypeThree && form.isTgThree === '1'"
        >
          <a-col :span="8" v-if="proThree">
            <a-form-model-item label="服务机构（三）" prop="orgTypeThree">
              <a-select
                placeholder="请选择服务机构"
                v-model="form.orgTypeThree"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @change="handleGetProductInfoThree"
                disabled
              >
                <a-select-option
                  v-for="(d, index) in orgTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="proThree">
            <a-form-model-item label="产品名称（三）" prop="productIdThree">
              <a-select
                placeholder="请选择产品"
                v-model="form.productIdThree"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @select="handleChooseProductThree"
                disabled
              >
                <a-select-option
                  v-for="d in productListThree"
                  :key="d.productName"
                  :value="d.id"
                  >{{ d.productName }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row
          :gutter="32"
          style="width: 80%; margin-left: 15%; margin-top: -10px"
        >
          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >服务费用</span
              >
            </div>
          </a-col>
          <a-col :span="8">
            <a-form-model-item
              label="客户是否同意服务费用"
              prop="agreeServiceAmount"
            >
              <a-radio-group
                default-value="0"
                v-model="form.agreeServiceAmount"
                disabled
              >
                <a-radio value="0"> 同意 </a-radio>
                <a-radio value="1"> 不同意 </a-radio>
              </a-radio-group></a-form-model-item
            >
          </a-col>
          <a-col :span="8" v-if="form.agreeServiceAmount != '1'">
            <a-form-model-item label="服务费" prop="serviceAmount">
              <a-input-number
                v-model="form.serviceAmount"
                :min="0"
                style="width: 100%"
                placeholder="请输入服务费"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="费用备注" prop="serviceAmountRemark">
              <a-input
                type="textarea"
                v-model="form.serviceAmountRemark"
                placeholder="请输入费用备注"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >贷款信息</span
              >
            </div>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请金额（元）" prop="yxEdu">
              <a-input-number
                v-model="form.yxEdu"
                :min="0"
                style="width: 100%"
                placeholder="请输入申请金额（元）"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="签约金额（元）" prop="sjEdu">
              <a-input-number
                v-model="form.sjEdu"
                :min="0"
                style="width: 100%"
                placeholder="请输入签约金额（元）"
                @change="handleChangeMonthAmount"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="放款时间" prop="fkTime">
              <a-date-picker
                v-model="form.fkTime"
                valueFormat="YYYY-MM-DD"
                style="width: 100%"
                @change="handleOverTimeChange"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="分期时间（月数）" prop="fenqiTime">
              <a-input-number
                v-model="form.fenqiTime"
                :min="0"
                style="width: 100%"
                placeholder="请输入分期时间（月数）"
                @change="handleFenqiTimeChange"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="还款方式" prop="backType">
              <a-radio-group
                v-model="form.backType"
                button-style="solid"
                @change="handleChangeMonthAmount"
                disabled
              >
                <a-radio-button
                  v-for="(d, index) in backTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}
                </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="年利率" prop="lv">
              <a-input-number
                v-model="form.lv"
                :min="0"
                :max="100"
                style="width: 100%"
                :precision="2"
                placeholder="请输入年利率"
                :formatter="(value) => `${value}%`"
                :parser="(value) => value.replace('%', '')"
                @change="handleChangeMonthAmount"
                disabled
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="月供金额（元）" prop="monthAmount">
              <a-input-number
                v-model="form.monthAmount"
                :min="0"
                style="width: 100%"
                placeholder="请输入月供金额（元）"
                disabled
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="抵押时间（天数）" prop="diyaTime">
              <a-input
                v-model="form.diyaTime"
                placeholder="请输入抵押时间"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="签单时间" prop="qiandanTime">
              <a-date-picker
                v-model="form.qiandanTime"
                valueFormat="YYYY-MM-DD"
                :show-today="true"
                placeholder="选择日期"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="到期时间" prop="overTime">
              <a-date-picker
                v-model="form.overTime"
                valueFormat="YYYY-MM-DD"
                :show-today="true"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="每月还款日" prop="monthlyPayDate">
              <a-input-number
                v-model="form.monthlyPayDate"
                :min="1"
                :max="31"
                style="width: 100%"
                :precision="0"
                placeholder="请输入每月还款日"
                :formatter="(value) => `${value}日`"
                :parser="(value) => value.replace('日', '')"
                disabled
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >其他信息</span
              >
            </div>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="合同签署" prop="hetongQianshu">
              <a-radio-group
                v-model="form.hetongQianshu"
                button-style="solid"
                disabled
              >
                <a-radio-button value="1"> 是 </a-radio-button>
                <a-radio-button value="0"> 否</a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="服务合同" prop="serviceContractSign">
              <a-radio-group
                v-model="form.serviceContractSign"
                button-style="solid"
                disabled
              >
                <a-radio-button value="1"> 是 </a-radio-button>
                <a-radio-button value="0"> 否</a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="GPS安装" prop="isGps">
              <a-radio-group
                v-model="form.isGps"
                button-style="solid"
                @change="handleGpsOnChange"
                disabled
              >
                <a-radio-button value="1"> 是 </a-radio-button>
                <a-radio-button value="0"> 否</a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="钥匙配置" prop="beiyongKey">
              <a-radio-group
                v-model="form.beiyongKey"
                button-style="solid"
                disabled
              >
                <a-radio-button value="1"> 是 </a-radio-button>
                <a-radio-button value="0"> 否</a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="抵押下单" prop="diyaSign">
              <a-radio-group
                v-model="form.diyaSign"
                button-style="solid"
                disabled
              >
                <a-radio-button value="1"> 是 </a-radio-button>
                <a-radio-button value="0"> 否</a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="抵押寄出" prop="diyaSendOut">
              <a-radio-group
                v-model="form.diyaSendOut"
                button-style="solid"
                disabled
              >
                <a-radio-button value="1"> 是 </a-radio-button>
                <a-radio-button value="0"> 否</a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="车辆保单" prop="carInsurancePolicy">
              <a-radio-group
                v-model="form.carInsurancePolicy"
                button-style="solid"
                disabled
              >
                <a-radio-button value="1"> 是 </a-radio-button>
                <a-radio-button value="0"> 否</a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>

          <a-col :span="24">
            <a-form-model-item label="备注" prop="remark">
              <a-input
                type="textarea"
                v-model="form.remark"
                placeholder="请输入备注"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button @click="cancel"> 取消 </a-button>
        </a-space>
      </div>
    </a-form-model>

    <a-modal
      :visible="chooseUserVisible"
      title="选择客服"
      v-if="chooseUserVisible"
      width="55%"
      @ok="chooseUserVisible = false"
      @cancel="chooseUserVisible = false"
      :dialog-style="{ top: '10px' }"
    >
      <change-user
        @getUser="handleManualShare"
        :isCheckBox="true"
        :isKefu="1"
      />
    </a-modal>
  </a-drawer>
</template>

<script>
import BizJinjianInfoEditForm from "./BizJinjianInfoForm";
export default {
  ...BizJinjianInfoEditForm,
};
</script>
